<template>
	<view class="category">
		<view class="category-container">
			<Search></Search>
			<CategoryArea :list="categoryData"></CategoryArea>
		</view>
	</view>
</template>

<script>
	import { categoryData as categoryDataApi } from '@/api/category'

	import Search from './components/Search'
	import CategoryArea from './components/CategoryArea'
	export default {
		components: {
			Search,
			CategoryArea
		},
		data() {
			return {
				categoryData: []
			}
		},
		onLoad () {
			this.getCategoryList()
		},
		methods: {
			async getCategoryList () {
				const { status, data, msg } = await categoryDataApi()
				if (status === this.API_STATUS_CODE.SUCCESS) {
					this.categoryData = data
				} else {
					uni.showToast({
						icon: 'none',
						title: '分类数据获取失败，请刷新重试',
						duration: 3000
					})
				}
			}
		}
	}
</script>

<style>

</style>
